package cn.b.sky.user;

import cn.b.sky.user.service.LoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.session.SessionDestroyedEvent;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Component
public class MySessionRegistryImpl extends SessionRegistryImpl {

  @Autowired
  private LoginLogService loginLogService;

  @Override
  public void onApplicationEvent(SessionDestroyedEvent event) { 
    
    super.onApplicationEvent(event);
    //修改超时日志登陆
    loginLogService.modifyLoginLog(event.getId());
  }

  public void setLoginLogService(LoginLogService loginLogService) {
    this.loginLogService = loginLogService;
  }
}
